import { BasicColumn, FormSchema } from '@apps/antd-admin/src/components/Table';
import { render } from '@apps/antd-admin/src/hooks/render/renderUtils';

export const columns: BasicColumn[] = [
  {
    title: '操作类型',
    dataIndex: 'optType',
    width: 200,
    customRender: ({ record }: Recordable) => {
      const optTypeArray = [
        { label: '解绑微信', value: 'unBindOpenId' },
        { label: '禁用启用', value: 'drawDownUser' },
        { label: '重置密码', value: 'resetPwd' },
        { label: '修改销售', value: 'updateUserGoodsEmployee' },
        { label: '修改完善资料', value: 'updateUserGoodsPrivateData' },
        { label: '同步到机场', value: 'syscAirportUserGoods' },
        { label: '卡种升级', value: 'upgradeUserGoods' },
        { label: '换绑手机', value: 'untyingMobile' },
      ];
      const optType: any = optTypeArray.find((item) => item.value == record.optType);
      if (optType) {
        return optType.label;
      }
      return '';
    },
  },
  {
    title: '业务类型',
    dataIndex: 'businessType',
    width: 200,
  },
  {
    title: '操作值',
    dataIndex: 'content',
    width: 200,
    customRender: render.renderHtmlToText,
  },
  {
    title: '操作人',
    dataIndex: 'optUserName',
    width: 120,
  },
  {
    title: '创建时间',
    dataIndex: 'createTime',
    width: 200,
  },
];

export const searchFormSchema: FormSchema[] = [
  {
    field: 'startDate',
    label: '开始日期',
    component: 'DatePicker',
    colProps: { span: 6 },
    componentProps: {
      valueFormat: 'YYYY-MM-DD',
      format: 'YYYY-MM-DD',
    },
  },
  {
    field: 'endDate',
    label: '结束日期',
    component: 'DatePicker',
    colProps: { span: 6 },
    componentProps: {
      valueFormat: 'YYYY-MM-DD',
      format: 'YYYY-MM-DD',
    },
  },
  {
    field: 'optUserName',
    label: '操作人',
    component: 'Input',
    colProps: { span: 6 },
  },
];
